home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / CSMP Digests / csmp-v1-020.txt < prev    next >
Encoding:
Text File  |  1992-11-18  |  50.7 KB  |  1,373 lines  |  [TEXT/MPS ]

  1. C.S.M.P. Digest             Tue, 17 Mar 92       Volume 1 : Issue 20
  2.  
  3. Today's Topics:
  4.  
  5.     What is system error #90?
  6.     DA problem (6.07)
  7.     How to turn off disk cacheing in System 7
  8.     malloc in thinkC
  9.     System Error 33
  10.     Setting private CDEF values?
  11.     Wanted, workaround to UpdateMovieResource() "feature"
  12.     >>MAC ARCHIVE is being killed.. PLEASE HELP<<
  13.     MPW Programming Guide
  14.     Gunky 32K static (initialized) data segment barrier
  15.  
  16.  
  17. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  18.  
  19. These digests are available (by using FTP, account anonymous, your email
  20. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  21. edu (try skinner.cs.uoregon.edu if that doesn't work).  This is also the home
  22. of the comp.sys.mac.programmer Frequently Asked Questions list.
  23.  
  24. These digests are also available via email.  Just send a note saying that you
  25. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  26. automatically receive each new digest as it is created.
  27.  
  28. The articles in these digests are taken directly from comp.sys.mac.programmer.
  29. They are not edited; all articles included in this digest are in their original
  30. posted form.  The only articles that are -not- included in these digests are
  31. those which didn't receive any replies (except those that give information
  32. rather than ask a question).  All replies to each article are concatenated
  33. onto the original article in the order in which they were received.  Article
  34. threads are not added to the digests until the last article added to the
  35. thread is at least one month old (this is to ensure that the thread is dead
  36. before adding it to the digests).
  37.  
  38. Send administrative mail to mkelly@cs.uoregon.edu.
  39.  
  40. -------------------------------------------------------
  41.  
  42. From: stanger@otago.ac.nz (Nigel Stanger)
  43. Subject: What is system error #90?
  44. Date: 11 Feb 92 21:49:56 GMT
  45. Organization: University of Otago, Dunedin, New Zealand
  46.  
  47. I was trying to load an Excel file this morning. I was on an si
  48. and was loading the file off a floppy. It would get as far as
  49. 2% loaded then CRASH! System error #90. I went and looked it up
  50. in the System Errors list. IT'S NOT THERE?!
  51.  
  52. Yup, system error #90 is not documented in anything I've got
  53. immediate access in (including IM1-6). What on earth is error
  54. #90? Numbers 87-89 are "Could not load WDEF/CDEF/MDEF". Could 90
  55. be LDEF? Help!
  56.  
  57. (BTW, this problem only seems to happen on this one particular
  58. si, hopefully knowing what the error is might give me some handle
  59. on figuring out the problem. Then again, maybe not :)
  60.  
  61. -- 
  62. See ya
  63.                                 Nigel.
  64. - --------------------------------------------------------------------
  65. Nigel Stanger,                  Internet: stanger@otago.ac.nz
  66. University of Otago,            Phone: +64 3 479-8179
  67. Dunedin, NEW ZEALAND.           Fax:   +64 3 479-8311
  68. Today's tang tongueler: try saying "Samuel Butler Yates" fast 3 times.
  69.  
  70.  
  71.  
  72. - -------------------------
  73.  
  74. From: Pete.Gontier@p811.f70.n109.z1.FidoNet.Org (Pete Gontier)
  75. Subject: What is system error #90?
  76. Date: 12 Feb 92 02:42:15 GMT
  77.  
  78.  
  79.  NS> From: stanger@otago.ac.nz (Nigel Stanger)
  80.  
  81.  NS> Yup, system error #90 is not documented in anything I've got
  82.  
  83. How about "Somebody passed garbage to _SysError"? :-)
  84.  * Origin: EC Technology, Santa Barbara, CA (1:109/70.811)
  85.  
  86.  
  87.  
  88. - -------------------------
  89.  
  90. From: jxs18@po.CWRU.Edu (Jerry Sy)
  91. Subject:  What is system error #90?
  92. Organization: Case Western Reserve University, Cleveland, OH (USA)
  93. Date: Wed, 12 Feb 92 13:42:42 GMT
  94.  
  95.  
  96. In a previous article, Pete.Gontier@p811.f70.n109.z1.FidoNet.Org (Pete Gontier) says:
  97.  
  98. > NS> From: stanger@otago.ac.nz (Nigel Stanger)
  99. >
  100. > NS> Yup, system error #90 is not documented in anything I've got
  101. >
  102. >How about "Somebody passed garbage to _SysError"? :-)
  103. > * Origin: EC Technology, Santa Barbara, CA (1:109/70.811)
  104. >
  105.  
  106. Well, I guess you have not looked HARD enough.
  107.  
  108. Simply checking the Errors.h file of my think c compiler reveals that this
  109. is a noFPU error.  You are running a software with FPU code on a machine
  110. without an FPU !!  try using softFPU or some other FPU emulator.
  111.  
  112. jerry sy
  113.  
  114.  
  115.  
  116.  
  117.  
  118. - -------------------------
  119.  
  120. From: foc@ausom.oz.au (Frank O'Connor)
  121. Subject:  What is system error #90?
  122. Date: 16 Feb 92 03:56:38 GMT
  123. Organization: AUSOM - The Apple Users Society of Melbourne
  124.  
  125. PG
  126. PG> NS> From: stanger@otago.ac.nz (Nigel Stanger)
  127. PG
  128. PG> NS> Yup, system error #90 is not documented in anything I've got
  129. PG>How about "Somebody passed garbage to _SysError"? :-)
  130.  
  131. Nice one, Pete.
  132.  
  133. I've got System Error 90 down as the execution of an FPU instruction
  134. when no FPU is installed. You might get around it by installing the
  135. Software FPU init - which traps same and executes in software.
  136.  
  137. Regards,
  138. -- 
  139. - ----------------------------------------
  140. Listen, someone is screaming in agony!
  141. Fortunately I speak it fluently
  142. - ----------------------------------------
  143.  
  144.  
  145.  
  146. - -------------------------
  147.  
  148. From: Pete.Gontier@p811.f70.n109.z1.FidoNet.Org (Pete Gontier)
  149. Subject:  What is system error #90?
  150. Date: 14 Feb 92 04:51:19 GMT
  151.  
  152.  
  153.  JS> From: jxs18@po.CWRU.Edu (Jerry Sy)
  154.  
  155.  JS> Simply checking the Errors.h file of my think c compiler reveals that
  156.  JS> this is a noFPU error.  You are running a software with FPU code on a 
  157.  JS> machine without an FPU !!  try using softFPU or some other FPU emulator.
  158.  
  159. Sonofabitch! I didn't know those were in there. Thanks for the tip.
  160.  * Origin: EC Technology, Santa Barbara, CA (1:109/70.811)
  161.  
  162.  
  163.  
  164. ---------------------------
  165.  
  166. From: guelzow@brandonu.ca
  167. Subject: DA problem (6.07)
  168. Date: 12 Feb 92 17:10:23 GMT
  169. Organization: Brandon University, Brandon, Manitoba, Canada
  170.  
  171. I have a problem with a deskaccessory I have written (Think C 4). Does 
  172. somebody know what may be wrong considering the following symptom:
  173. If I install the DA into 6.07 with F/DA Mover 3.8, then restart the Mac
  174. everything works fine. If I use the same procedure but do not restart,
  175. a system error (illegal instruction) occurs upon selecting the DA from
  176. the menu. The DA menu has not yet appeared. (This is on an LC, but the crash
  177. has also ben reported by other people (with unknown Mac and system 6.04
  178. & 6.05). There is no problem with runing the DA from the Desktop under 7+).
  179.  
  180. Thank you for any suggestion. 
  181. - -----------------------------------------------------------------------------
  182. Andreas Guelzow  Dept. of Mathematics & Comp. Sc. Brandon University MB Canada
  183. Guelzow@BrandonU.Ca
  184.  
  185.  
  186.  
  187. - -------------------------
  188.  
  189. From: guelzow@brandonu.ca
  190. Subject:  DA problem (6.07)
  191. Date: 13 Feb 92 14:54:52 GMT
  192. Organization: Brandon University, Brandon, Manitoba, Canada
  193.  
  194. In article <1992Feb12.111023.1265@brandonu.ca>, I wrote:
  195. > I have a problem with a deskaccessory I have written (Think C 4). Does 
  196. > somebody know what may be wrong considering the following symptom:
  197. > If I install the DA into 6.07 with F/DA Mover 3.8,
  198. or 4.1 on a Mac LC
  199. > then restart the Mac
  200. > everything works fine. If I use the same procedure but do not restart,
  201. > a system error (illegal instruction) occurs upon selecting the DA from
  202. > the menu.
  203. While the DRVR resource has been loaded any of my code in the DCOD resource
  204. has not been reached, in fact it hasn't even been loaded. (I am writing a
  205. multi-segment DA.) The "illegal instruction" is not in any heap and decompiling
  206. that part of memory shows that the instruction is in fact the second half of
  207. one.
  208. > The DA menu has not yet appeared. (This is on an LC, but the crash
  209. > has also ben reported by other people (with unknown Mac and system 6.04
  210. > & 6.05). There is no problem with runing the DA from the Desktop under 7+).
  211. I also have no problem on my Mac Plus. On it I can't persuade the programme
  212. to crash. This makes finding the bug very difficult.
  213. > Thank you for any suggestion. 
  214. - -----------------------------------------------------------------------------
  215. Andreas Guelzow  Dept. of Mathematics & Comp. Sc. Brandon University MB Canada
  216. Guelzow@BrandonU.Ca
  217.  
  218.  
  219.  
  220. ---------------------------
  221.  
  222. From: dcastell@csg.uwaterloo.ca (David Castell)
  223. Subject: How to turn off disk cacheing in System 7
  224. Date: 13 Feb 92 15:13:54 GMT
  225. Organization: Computer Systems Group
  226.  
  227. In the past I have seen some people asking about turning off disk cacheing
  228. under System 7.  I think I might have the answer.
  229.  
  230. In previous versions, to turn off disk cacheing you would turn off a bit
  231. in the Parameter Ram.  This does not work under System 7.  However, there
  232. is a low memory global called 'cacheCom' ($39c) which contains a bit called
  233. 'noRWIPbit' (bit 7).  The operating system routines that perform the cacheing
  234. are '_vCacheRdIP' and '_vCacheWrIP'.  These routines check the 'noRWIPbit'
  235. of CacheCom when deciding whether or not to perform the cacheing.  If the
  236. bit is set, cacheing will not be performed.
  237.  
  238. If you want to have cacheing on in general, but don't want a particular
  239. Read or Write call to be cached, set 'noCacheBit' (bit 5) in the ioPosMode
  240. field of the Read or Write call.
  241.  
  242. NOTE: These two methods of manipulating cacheing are available in system 6
  243. of the OS as well as system 7.  (and maybe even earlier versions, but I can't
  244. verify this).
  245.  
  246. I hope this is of some help.
  247.  
  248. Dave Castell
  249. Computer Systems Group
  250.  
  251.  
  252.  
  253. - -------------------------
  254.  
  255. From: Mike Wiese <mlwiese@mit.edu>
  256. Subject:  How to turn off disk cacheing in System 7
  257. Organization: MIT
  258. Date: Thu, 13 Feb 1992 19:55:40 GMT
  259.  
  260. >In the past I have seen some people asking about turning off disk
  261. cacheing
  262. >under System 7.  I think I might have the answer.
  263. >
  264. >In previous versions, to turn off disk cacheing you would turn off a bit
  265. >in the Parameter Ram.  This does not work under System 7.  However, there
  266. >is a low memory global called 'cacheCom' ($39c) which contains a bit
  267. called
  268. >'noRWIPbit' (bit 7).  The operating system routines that perform the
  269. cacheing
  270. >are '_vCacheRdIP' and '_vCacheWrIP'.  These routines check the
  271. 'noRWIPbit'
  272. >of CacheCom when deciding whether or not to perform the cacheing.  If the
  273. >bit is set, cacheing will not be performed.
  274.  
  275.  
  276.  
  277. ---------------------------
  278.  
  279. From: dubreuil@cert.fr (Christophe Dubreuil)
  280. Subject: malloc in thinkC
  281. Date: 14 Feb 92 09:48:57 GMT
  282. Organization: CERT, CS Dpt. Toulouse, France
  283.  
  284.  
  285. I got thinkC 4.0.5, I allready programmed in C
  286. in a UNIX environnement, and I have been a 
  287. fervent Mac user.
  288.  
  289. But help !!!
  290.  
  291. Malloc allways return a NULL pointer in thinkC.
  292. Am I missing something:
  293.  
  294. - not including the right libraries ?
  295.  
  296. - using malloc instead of another memory
  297.   allocation fonction specific to the mac ?
  298.  
  299. Any help is welcome.
  300.  
  301.  
  302. - ------------------------------------------------------------------------
  303. Christophe Dubreuil,                   GIA DERI CERT ONERA, 2 av. E. Belin
  304. dubreuil@tls-cs.cert.fr           B.P. 4025, 31055 Toulouse Cedex,  France
  305.  
  306.  
  307.  
  308. - -------------------------
  309.  
  310. From: chou@cs.washington.edu (Pai Hsiang Chou)
  311. Subject:  malloc in thinkC
  312. Organization: Computer Science & Engineering, U. of Washington, Seattle
  313. Date: Fri, 14 Feb 92 11:29:19 GMT
  314.  
  315. In article <193@tls-cs.cert.fr> dubreuil@cert.fr (Christophe Dubreuil) writes:
  316. >
  317. >I got thinkC 4.0.5, I allready programmed in C
  318. >in a UNIX environnement, and I have been a 
  319. >fervent Mac user.
  320. >
  321. >But help !!!
  322. >
  323. >Malloc allways return a NULL pointer in thinkC.
  324.  
  325. In THINK C, malloc takes a 16-bit argument.
  326. This means you can allocate up to only 32K chunks at a time.
  327. This is probably due to the fact that you can't index an array
  328. that's bigger than 32K.
  329.  
  330. If you pass a longint (32-bit) argument, then chances are the
  331. higher order 2 bytes are zero, so you got a NULL pointer.
  332.  
  333. >Am I missing something:
  334. >
  335. >- not including the right libraries ?
  336.  
  337. You might want to turn on "Require Prototypes" and include the
  338. header files.  ANSI C Prototypes will take care of typecasting
  339. some arguments like int/longint.
  340.  
  341.  
  342. >- using malloc instead of another memory
  343. >  allocation fonction specific to the mac ?
  344.  
  345. Or you could call the Mac Toolbox routines NewHandle() or
  346. NewPtr().  They don't have the 32K restriction, but you
  347. can't index more than 32K at a time; you can get around this
  348. by computing pointers yourself.
  349.  
  350. Pai
  351.  
  352.  
  353.  
  354. - -------------------------
  355.  
  356. From: siegel@world.std.com (Rich Siegel)
  357. Subject:  malloc in thinkC
  358. Date: 14 Feb 92 13:01:54 GMT
  359. Organization: Symantec Language Products Group
  360.  
  361. In article <1992Feb14.112919.9995@beaver.cs.washington.edu> chou@cs.washington.edu (Pai Hsiang Chou) writes:
  362. >>
  363. >>But help !!!
  364. >>
  365. >>Malloc allways return a NULL pointer in thinkC.
  366. >
  367. >In THINK C, malloc takes a 16-bit argument.
  368. >This means you can allocate up to only 32K chunks at a time.
  369. >This is probably due to the fact that you can't index an array
  370. >that's bigger than 32K.
  371.  
  372.     This is half correct. In THINK C 4.0, malloc() did indeed take
  373. a 16-bit argument; however, it has nothing to do with array indexing
  374. limitations - you can have arrays whose aggregate size is bigger than
  375. 32K, and you can index them just fine. They can't be statically declared
  376. in THINK C 4.0, but that's beside the point.
  377.  
  378.     Furthermore, THINK C 4.0 includes a routine mlalloc(). (Note the "L".)
  379. This routine takes a long as its argument. This is also beside the point.
  380.  
  381.     A common cause of "failure" in malloc() is failure to include 
  382. <storage.h>; any undeclared function defaults to a return-type of 'int',
  383. and malloc() returns a 32-bit value, not a 16-bit value.
  384.  
  385.     THINK C 5.0 includes a set of libraries which are conformant with
  386. the ANSI spec; as such, there is no mlalloc(), and malloc() itself takes
  387. a size_t as its argument, which is a long. The C 5.0 libraries are, on the
  388. whole, somewhat better defined and more reliable than previous versions.
  389. Upgrading is recommended.
  390.  
  391. R.
  392.  
  393.  
  394.  
  395. -- 
  396. - ---------------------------------------------------------------------
  397. Rich Siegel                              Internet: siegel@world.std.com
  398. Senior Software Engineer                 Applelink: SIEGEL
  399. Symantec Languages Group
  400.  
  401.  
  402.  
  403. - -------------------------
  404.  
  405. From: tcwan@umiami.ir.miami.edu
  406. Subject:  malloc in thinkC
  407. Date: 14 Feb 92 19:46:32 GMT
  408. Organization: Univ of Miami IR
  409.  
  410. In article <BJM477.J86@world.std.com>, siegel@world.std.com (Rich Siegel) writes:
  411. > In article <1992Feb14.112919.9995@beaver.cs.washington.edu> chou@cs.washington.edu (Pai Hsiang Chou) writes:
  412. >>>
  413. >>>But help !!!
  414. >>>
  415. >>>Malloc allways return a NULL pointer in thinkC.
  416. >>
  417. >>In THINK C, malloc takes a 16-bit argument.
  418. >>This means you can allocate up to only 32K chunks at a time.
  419. >>This is probably due to the fact that you can't index an array
  420. >>that's bigger than 32K.
  421. >     This is half correct. In THINK C 4.0, malloc() did indeed take
  422. > a 16-bit argument; however, it has nothing to do with array indexing
  423. > limitations - you can have arrays whose aggregate size is bigger than
  424. > 32K, and you can index them just fine. They can't be statically declared
  425. > in THINK C 4.0, but that's beside the point.
  426. >     Furthermore, THINK C 4.0 includes a routine mlalloc(). (Note the "L".)
  427. > This routine takes a long as its argument. This is also beside the point.
  428. >     A common cause of "failure" in malloc() is failure to include 
  429. > <storage.h>; any undeclared function defaults to a return-type of 'int',
  430. > and malloc() returns a 32-bit value, not a 16-bit value.
  431. >     THINK C 5.0 includes a set of libraries which are conformant with
  432. > the ANSI spec; as such, there is no mlalloc(), and malloc() itself takes
  433. > a size_t as its argument, which is a long. The C 5.0 libraries are, on the
  434. > whole, somewhat better defined and more reliable than previous versions.
  435. > Upgrading is recommended.
  436.  
  437. Well, in THINK C 5.0, you still have to include <stdlib.h> or you're liable
  438. to be stuck with the same NULL problem. (This is documented in Think's  Std.
  439. C Lib Reference). I was puzzled by why it occurs with blocks of 16K or 
  440. thereabouts though. It works fine for anything smaller (because it is
  441. allocated by THINK C from its free list), and larger blocks are handled by 
  442. calling NewPtr(). It's just this range of block sizes of about 16K that 
  443. causes it to fail. After including <stdlib.h>, it works properly.
  444.  
  445. Does anyone know why?
  446.  
  447. T.C. Wan
  448. Grad Student, 
  449. Univ of Miami, FL
  450.  
  451. > R.
  452. > -- 
  453. > -----------------------------------------------------------------------
  454. > Rich Siegel                              Internet: siegel@world.std.com
  455. > Senior Software Engineer                 Applelink: SIEGEL
  456. > Symantec Languages Group
  457.  
  458.  
  459.  
  460. - -------------------------
  461.  
  462. From: swofford@uxh.cso.uiuc.edu (David Swofford )
  463. Subject:  malloc in thinkC
  464. Organization: University of Illinois at Urbana
  465. Date: Fri, 14 Feb 1992 23:23:39 GMT
  466.  
  467. siegel@world.std.com (Rich Siegel) writes:
  468.  
  469. >    THINK C 5.0 includes a set of libraries which are conformant with
  470. >the ANSI spec; as such, there is no mlalloc(), and malloc() itself takes
  471. >a size_t as its argument, which is a long. The C 5.0 libraries are, on the
  472. >whole, somewhat better defined and more reliable than previous versions.
  473. >Upgrading is recommended.
  474.  
  475. On the whole, I completely agree with this statement, but one aspect of the
  476. new malloc scheme really bothers me.  In THINK C 5 library, memory requests
  477. of less than 15K bytes are filled from 15K "zones" with new zones being 
  478. allocated as necessary.  The obvious benefits of this strategy are that 
  479. far fewer calls to the Mac Memory Manager routines are necessary, and 
  480. there is much less memory overhead for block headers (they use a clever
  481. system that requires only 6 bytes of header for each block (two bytes
  482. for the size, 4 bytes for either a pointer or a flag indicating that the
  483. block has been freed or was >15K and therefore allocated by NewPtr)).
  484.  
  485. The problem is that if all of the blocks within a 15K zone are freed, the
  486. zone itself is not returned to the Memory Manager; it just sits there
  487. plugging up memory (Rich, please correct me if I'm wrong, but this was
  488. my experience).  This proved deadly to one part of my application.  I      
  489. allocate a linked list of large (say, 12K) structures by successive calls
  490. to malloc.  This is all done at one time following a certain action by
  491. the user.  Suppose that after allocating 18 of 20 of these structures, the
  492. Mac runs out of memory.  No problem, just run back through the list, free
  493. all the blocks allocated so far, and tell the user there's not enough 
  494. memory to do what s/he wants.  But when the THINK C free is called, it 
  495. just marks the block as available for filling future requests.  This 
  496. means that I've now got 18 empty 15K nonrelocatable blocks and no free
  497. memory for any other purpose (e.g., handles for Mac interface stuff).  
  498. If the user decides to change the request so that only half as many of
  499. these list items are needed, I can recover half the memory, but there's
  500. STILL no memory for requests outside of the malloc/free realm.  In my
  501. case, the problem was severe enough that I had to resort to writing my
  502. own versions of malloc and free that just called NewPtr and DisposPtr
  503. forgoing all of the advantages of THINK's new system.
  504.  
  505. The obvious solution would be to modify the library's version of free
  506. so that after every call to free, it checked to see whether there were
  507. any blocks left in the zone, and if not, freed the entire zone.  I could
  508. do this myself, but I'd rather THINK did it.
  509.  
  510. PLEASE NOTE:  This application runs on everything from Macs to IBM PCs 
  511. to Unix workstations to Cray Y/MPs.  For portability, I really want to
  512. use malloc/free.  The usual suggestions that I should be using 
  513. relocatable blocks rather than malloc/free are not welcome.
  514. --
  515. David L. Swofford                 Phone:    (217)244-6959
  516. Illinois Natural History Survey   FAX:      (217)333-4949
  517. 607 E. Peabody Drive              BITNET:   DAVESWOF@UIUCVMD
  518. Champaign, Illinois 61820 USA     Internet: swofford@uxh.cso.uiuc.edu
  519.  
  520.  
  521.  
  522. - -------------------------
  523.  
  524. From: mkahl@world.std.com (Michael Kahl)
  525. Subject:  malloc in thinkC
  526. Date: 15 Feb 92 03:31:30 GMT
  527. Organization: Enginuity Inc.
  528.  
  529. In article <BJM477.J86@world.std.com> siegel@world.std.com (Rich Siegel) writes:
  530. >In article <1992Feb14.112919.9995@beaver.cs.washington.edu> chou@cs.washington.edu (Pai Hsiang Chou) writes:
  531. >>>
  532. >>>But help !!!
  533. >>>
  534. >>>Malloc allways return a NULL pointer in thinkC.
  535. >>
  536. >>In THINK C, malloc takes a 16-bit argument.
  537. >>This means you can allocate up to only 32K chunks at a time.
  538.  
  539. Not true.  malloc takes a size_t, which is an unsigned long.
  540.  
  541. >>This is probably due to the fact that you can't index an array
  542. >>that's bigger than 32K.
  543.  
  544. Also not true.  You can't declare an array that big, but a dynamically allocated
  545. array has no such limit.
  546.  
  547. >    This is half correct. In THINK C 4.0, malloc() did indeed take
  548. >a 16-bit argument; however, it has nothing to do with array indexing
  549. >limitations - you can have arrays whose aggregate size is bigger than
  550. >32K, and you can index them just fine. They can't be statically declared
  551. >in THINK C 4.0, but that's beside the point.
  552.  
  553. This is half correct. :-)  Large (i.e. >32K) arrays can be indexed though not
  554. statically declared; but the argument to malloc is a 32-bit int, not a 16-bit
  555. int.
  556.  
  557. >    Furthermore, THINK C 4.0 includes a routine mlalloc(). (Note the "L".)
  558. >This routine takes a long as its argument. This is also beside the point.
  559.  
  560. No.  I believe that version 3.0 had mlalloc (or clalloc), but with the advent
  561. of the ANSI libraries in 4.0, it was dropped.
  562.  
  563. >    A common cause of "failure" in malloc() is failure to include 
  564. ><storage.h>; any undeclared function defaults to a return-type of 'int',
  565. >and malloc() returns a 32-bit value, not a 16-bit value.
  566.  
  567. Storage.h was present in old versions, but disappeared in 4.0.  It's true that
  568. it is important to include <stdlib.h> when using malloc, in order to get the
  569. argument and return types declared properly.
  570.  
  571. >    THINK C 5.0 includes a set of libraries which are conformant with
  572. >the ANSI spec; as such, there is no mlalloc(), and malloc() itself takes
  573. >a size_t as its argument, which is a long. The C 5.0 libraries are, on the
  574. >whole, somewhat better defined and more reliable than previous versions.
  575.  
  576. True, but this change was introduced in 4.0.
  577.  
  578. >Upgrading [to 5.0] is recommended.
  579.  
  580. Also true, but not because of the standard libraries, which did not change
  581. much.
  582.  
  583. -- 
  584. Michael Kahl, Software Architect, Enginuity Inc.
  585. mkahl@world.std.com  -or-  75236.3146@compuserve.com
  586. Disclaimer:  Whoa!  Did I say THAT??!
  587.  
  588.  
  589.  
  590. - -------------------------
  591.  
  592. From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
  593. Subject:  malloc in thinkC
  594. Organization: Symantec Corp.
  595. Date: Sun, 16 Feb 1992 17:12:28 GMT
  596.  
  597. >>>>> On 14 Feb 92 23:23:39 GMT, swofford@uxh.cso.uiuc.edu (David Swofford ) said:
  598.  
  599.  > (they use a clever system that requires only 6 bytes of header for
  600.  > each block (two bytes for the size, 4 bytes for either a pointer or
  601.  > a flag indicating that the block has been freed or was >15K and
  602.  > therefore allocated by NewPtr)).
  603.  
  604. Actually the overhead is only 2 bytes per block (3 if you're
  605. malloc'ing an odd sized block). The zones have an overhead of 8 bytes.
  606.  
  607.  > The problem is that if all of the blocks within a 15K zone are
  608.  > freed, the zone itself is not returned to the Memory Manager; it
  609.  > just sits there plugging up memory
  610.  
  611. This is the way that THINK C's malloc() works. This is part of the
  612. design, and it isn't considered to be a bug.
  613.  
  614.  > The obvious solution would be to modify the library's version of
  615.  > free so that after every call to free, it checked to see whether
  616.  > there were any blocks left in the zone, and if not, freed the
  617.  > entire zone.  I could do this myself, but I'd rather THINK did it.
  618.  
  619. It's possible that this feature would be added in the future, but we
  620. get very few complaints about its behavior -- if you really want it,
  621. I'd recommend adding in the support yourself. Remember that alloc()
  622. keeps a linked list of zones, so you'd have to patch up the list if
  623. you freed a zone.
  624.  
  625. One side note: for those that were confused by Rich's remarks about
  626. mlalloc(), 16 bit arguments and <storage.h>, he was referring to the
  627. libraries in C 3.0, not 4.0 (feel old, Rich? :-).
  628.  
  629.     -phil
  630. --
  631.    Phil Shapiro                           Technical Support Analyst
  632.    Language Products Group                     Symantec Corporation
  633.         Internet: phils@chaos.cs.brandeis.edu
  634.  
  635.  
  636.  
  637. ---------------------------
  638.  
  639. From: danmcd@cs.arizona.edu (Daniel L. McDonald)
  640. Subject: System Error 33
  641. Date: 14 Feb 92 16:53:41 GMT
  642. Organization: U of Arizona CS Dept, Tucson
  643.  
  644. I'm the administrator for a room full of Mac SE's.  They are all appletalked
  645. together.  The total node count for this subnet is 34
  646.  
  647.     1 FastPath link to the campus internet
  648.     1 Mac IIfx file server
  649.     32 SE's
  650.  
  651. THe workstations, especially at the end of the chain will bomb with system
  652. error 33.  Inside Mac #5 has it labelled as "ZcbFreeNeg" which means ZcbFree
  653. is negative.  I can't find what ZcbFree is.  Is it an Appletalk system value?
  654. Is the error resulting from too large a subnet?  That's my guess, but I'd like
  655. to verify it with you people.
  656.  
  657. I'm posting this to two newsgroups, and reading comp.sys.mac.programmer.
  658. Either mail to me, or post to comp.sys.mac.programmer.  Thanks!
  659.  
  660. +------------------+----------------------------------------------------------+
  661. | Dan McDonald     | Internet: danmcd@cs.arizona.edu  AT&Tnet: (602) 882-6148 |
  662. | Univ. of Arizona +----------------------------+ UUCP:..!uunet!arizona!danmcd|
  663. | Computer Science | "I was lined up for glory, +-----------------------------+
  664. | 1st year Grad.   |  but the tickets sold out in advance" - Rush (N. Peart)  |
  665. +------------------+----------------------------------------------------------+
  666.  
  667.  
  668.  
  669. - -------------------------
  670.  
  671. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  672. Subject:  System Error 33
  673. Organization: Kalamazoo College
  674. Date: Sun, 16 Feb 1992 16:55:38 GMT
  675.  
  676. danmcd@cs.arizona.edu (Daniel L. McDonald) writes:
  677. >I'm the administrator for a room full of Mac SE's.  They are all appletalked
  678. >together.
  679. >
  680. >THe workstations, especially at the end of the chain will bomb with system
  681. >error 33.  Inside Mac #5 has it labelled as "ZcbFreeNeg" which means ZcbFree
  682. >is negative.  I can't find what ZcbFree is.
  683.  
  684. Error 33 means your program was naughty:  it wrote someplace it wasn't
  685. supposed to, probably past the end of a chunk of memory.
  686.  
  687. The error occurs when the memory manager gets a request to do something,
  688. and in the course of setting up to do it, notices that the number of
  689. free blocks in the heap is _negative_.  This of course should never
  690. happen, and is only possible when its data structures get trashed.
  691.  
  692. It (probably) has nothing to do with the network situation, and
  693. everything to do with the software you're running at the time.
  694. -- 
  695.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  696.  Kzoo randomly kills all my mail;  if I don't acknowledge, try resending.    
  697.  
  698.  
  699.  
  700. ---------------------------
  701.  
  702. From: krk@itl.itd.umich.edu (Kenneth Knight)
  703. Subject: Setting private CDEF values?
  704. Date: 11 Feb 92 23:29:36 GMT
  705. Organization: Instructional Technology Laboratory, University of Michigan
  706.  
  707. I am creating a costum control for a project of mine. The costom control acts
  708. like the controls that manipulate the memory or clock settings that you find
  709. in Memory or General Control Panels. I want to give this control a good deal
  710. of flexibility and therefore I want to provide options (in a private data
  711. structure referenced via the cntlData Handle in the ControlRecord) for
  712. changing the interval that values change by, and options for controlling how
  713. fast the value changes (an acceleration of sorts). I have hard-coded some
  714. default values for these extra options, but I want to allow for the values to
  715. be modified if a resource of some type (e.g. 'arow') with the same ID as the
  716. CNTL resource (and , of course, the CNTL includes the information that points
  717. to the costum CDEF) that if found while the control is being set up will
  718. substitute the values withint that resource for the hard-coded ones already
  719. present. It makes sense to me to do all this work during the 'initCntl'
  720. message that is sent to the CDEF, but I can't figure out how to do this. Can
  721. anyone point me in the right direction, tell me what to do? Thanks....
  722.  
  723.   ** Ken **
  724.  
  725.  
  726. I am me and only me and speak just for me.
  727.  
  728.  
  729.  
  730. - -------------------------
  731.  
  732. From: re00+@andrew.cmu.edu (Robert H Earhart)
  733. Subject:  Setting private CDEF values?
  734. Date: 16 Feb 92 20:07:21 GMT
  735. Organization: Freshman, MCS general, Carnegie Mellon, Pittsburgh, PA
  736.  
  737.  
  738.   Have you considered using a preferences file? They're REALLY easy to
  739. manage under System Seven... and not as gross as modifying one's one
  740. resources, or the system file.
  741.  
  742.   -Rob
  743.  
  744.  
  745.  
  746. ---------------------------
  747.  
  748. Subject: Wanted, workaround to UpdateMovieResource() "feature"
  749. From: news@massey.ac.nz (USENET News System)
  750. Date: Sun, 16 Feb 1992 20:59:33 GMT
  751. Organization: School of Maths & Info. Sci., Massey University, Palmerston North, NZ
  752.  
  753.  
  754. The QT routine UpdateMovieResource() sets a files shared bit for some
  755. unknown reason. If you look at your Scrapbook file after you've pasted
  756. a movie in you'll see it now has it shared bit set. My problem is I
  757. was trying to use the "Gallery" application of the QT CD, which is
  758. just a version of scrapbook compiled as an app and which stores the
  759. scraps within itself.  It works fine as long as you don't paste in
  760. movies, once you do then the next time you launch the app the Finder
  761. pens the resource fork red only as its marked shared - which means
  762. pasting is no longer possible :-(. Anybody know WHY the bit is being set?
  763. Anybody have a fix?
  764.  
  765. Thanks in advance,
  766.  
  767.         Nigel
  768.  
  769. -- 
  770. - -
  771. Dr Nigel Perry                    Email: N.Perry@massey.ac.nz
  772. Department of Computer Science    Tel: +64 6 356 9099 ext 8900
  773. Massey University                 Fax: +64 6 350 5611
  774. Palmerston North
  775. New Zealand
  776.  
  777.  
  778.  
  779. ---------------------------
  780.  
  781. From: mike@ccs.itd.umich.edu (Mike Dautermann)
  782. Subject: >>MAC ARCHIVE is being killed.. PLEASE HELP<<
  783. Date: 14 Feb 92 06:45:52 GMT
  784. Organization: Archive Project, University of Mediocre
  785.  
  786. Dear mac-archive-user....
  787.  
  788. I have some very very disturbing and shocking (at least for me) news
  789. to relay to you....
  790.  
  791. Due to budget constraints at the U-M Information Technology Division, 
  792. a tenative decision has been made to cut and cease support of the largely
  793. volunteer archive service (i.e. mac.archive.umich.edu, msdos.archive.umich.edu,
  794. next.archive.umich.edu, linguistics.archive, atari, etc.).
  795.  
  796. Here is a copy of the message I received about a half hour ago
  797. from my supervisor on the project:
  798.  
  799. - ----
  800.   
  801. Message-Id: <9202140448.AA08771@terminator.cc.umich.edu>
  802. To: all-archivists@terminator.cc.umich.edu
  803. Subject: Death of the Archives?
  804. Date: Thu, 13 Feb 92 23:48:01 -0500
  805. From: "Fred Swartz" <swartz@terminator.cc.umich.edu>
  806.  
  807.  
  808.                            ... ...I don't know exactly how this will
  809. affect the 0.25 part of Allan and Mike that RS pays for, perhaps CSS
  810. and CITI will pick it up.  I'll let you know when/if I find out.
  811.  
  812. When I talked to Mike Clark (my manager in Research Systems) about
  813. continuing the archives on volunteer power (as it largely runs right
  814. now), he was very negative on the idea, but failed to supply a
  815. convincing argument for abandoning it.  I'm stunned and upset.
  816. The Archives have managed very well on volunteer effort up til now and
  817. it seems to me that something else is going on other than a genuine
  818. concern for serving the users.
  819.  
  820. I don't know what this means for the Archives, although they aren't
  821. going to be turned off tomorrow.  I'll let you know whatever I find out
  822. as soon as I can.
  823.  
  824.   -- Fred
  825.   
  826. - ---
  827.  
  828. I talked on the phone with Fred and we both agree that this decision
  829. seems very unfair to both the students/faculty who use the archives
  830. here at the University of Michigan, and you... the users on the
  831. Internet, Bitnet, UUCP, etc.  
  832.  
  833. To me, it doesn't make much sense to cut off support for the archives.
  834. Both I and Allan make around $70 a week working on the archives (I work
  835. on the Mac side, he works on the msdos side).. the rest of the time
  836. we spend is voluntary, like the twenty or so other people who add/keep
  837. up the archives here.  The archives are probably one of the most popular
  838. and beneficial services that ITD offers.  There may be other ways to trim
  839. the budget, but cutting off something that costs nearly nothing
  840. to begin with doesn't seem very wise.
  841.  
  842. Please help us out.  E-mail in support of our archives can be sent
  843. to archive.support@mac.archive.umich.edu.  We don't want to flood the
  844. senior managers' mailboxes, and we're still thinking about what we
  845. can do to save our archives.  Comments can be sent
  846. to us at "comments@mac.archive.umich.edu".  To address the entire
  847. archive group, you may send e-mail to "all-archivists@terminator.cc.umich.edu".
  848. Also, please let your other computer friends and acquaintances know what is
  849. going on.  We need as many letters/e-mail notes as possible in order
  850. to emphasize just how much the archives mean to people.
  851.   
  852. Thanks....
  853.  
  854. mike@mac.archive.umich.edu
  855.   
  856. p.s. I apologize for having to crosspost this to so many newsgroups.
  857. (I'm also probably risking getting fired, as well).  I just wanted
  858. you to be aware of what is happening and ask for you to consider about
  859. sending a note of support for us...
  860.  
  861. -- 
  862. - ---------------------------------------------------------------
  863. Mike Dautermann - U-M Ann Arbor, Dearborn and the World
  864. Mike @ ccs.itd.umich.edu = myke@engin.umich.edu = dauter@umich.edu
  865. = usermyke@umichum.bitnet --> that's MISTER archive to you.....
  866.  
  867.  
  868.  
  869. ---------------------------
  870.  
  871. From: cheng@ee.rochester.edu (Bruce Cheng)
  872. Subject: MPW Programming Guide
  873. Date: 21 Jan 92 14:24:34 GMT
  874. Organization: University of Rochester, Department of Electrical Engineering
  875.  
  876.  
  877.     Is there any good suggestion for Programming Guide for MPW? I curently only
  878.     have the reference manual that comes with the package.
  879.  
  880.     The MPW Programmer's Reference I and II.
  881.     Same for MPW C, I only have the Programmer's Reference.
  882.  
  883.     Or basically any material that can help me to shorten my learning curve
  884.     on Mac programming ...
  885.  
  886.  
  887. thanks a MEG!
  888. Bruce
  889. -- 
  890. +-----------------------------------------+------------------------------------+
  891. | Home: 716-271-0960(voice/data/fax)      |Usnet: cheng@ee.rochester.edu       |
  892. | Work: 716-427-6227                  |XNS: Bruce_Cheng.Henr801B@xerox.com |
  893. | Address: 1559 Elmwood Avenue Apt 8      |Uucp: uunet!rochester!ur-val!cheng  |
  894.  
  895.  
  896.  
  897. - -------------------------
  898.  
  899. From: keith@Apple.COM (Keith Rollin)
  900. Subject:  MPW Programming Guide
  901. Date: 28 Jan 92 23:08:14 GMT
  902. Organization: Apple Computer Inc., Cupertino, CA
  903.  
  904. In article <1992Jan21.142434.10822@ee.rochester.edu> cheng@ee.rochester.edu (Bruce Cheng) writes:
  905. >
  906. >    Is there any good suggestion for Programming Guide for MPW? I curently only
  907. >    have the reference manual that comes with the package.
  908. >
  909. >    The MPW Programmer's Reference I and II.
  910. >    Same for MPW C, I only have the Programmer's Reference.
  911. >
  912. >    Or basically any material that can help me to shorten my learning curve
  913. >    on Mac programming ...
  914.  
  915. I know of only two How To Use MPW books other than the reference
  916. manuals that come with it. The first is an Ages Old book by Joel West
  917. (I don't remember the name or publisher).  This book covers MPW 2.0,
  918. and may not be of much use. More recently is "Programmer's Guide to MPW"
  919. (right...so I don't accidentally think the book is appropriate for my
  920. mother), by Mark Andrews, published as part of the Macintosh Inside 
  921. Out series by Addison Wesley Crusher. This book is marked as Volume 1,
  922. so I guess more volumes are forthcoming (I heard a rumor that a Volume
  923. 2 is being worked on by Neil Rhodes, who used to (or still does) work
  924. with Joel West).
  925.  
  926. I've never read either of these books, so I don't know if they're any
  927. good.
  928.  
  929. -- 
  930. - ----------------------------------------------------------------------------
  931. Keith Rollin           ---            <Taligent .signature under construction>
  932. Disclaimer: Pretty soon, I really _won't_ be speaking for Apple...
  933.  
  934.  
  935.  
  936. - -------------------------
  937.  
  938. From: jess@gn.ecn.purdue.edu (Jess M Holle)
  939. Subject:  MPW Programming Guide
  940. Date: 29 Jan 92 04:11:47 GMT
  941. Organization: Purdue University Engineering Computer Network
  942.  
  943. Additionally, though it does not cover MPW in general, but rather just
  944. some facets of it and its use in programming various things is:
  945.  
  946. On Macintosh Programming: Advanced Techiques
  947. by Daniel K. Allen
  948. Addison/Wesley
  949.  
  950. This book may be of some help.
  951.  
  952. Jess Holle
  953.  
  954.  
  955.  
  956. - -------------------------
  957.  
  958. From: keith@Apple.COM (Keith Rollin)
  959. Subject:  MPW Programming Guide
  960. Date: 28 Jan 92 23:08:14 GMT
  961. Organization: Apple Computer Inc., Cupertino, CA
  962.  
  963. In article <1992Jan21.142434.10822@ee.rochester.edu> cheng@ee.rochester.edu (Bruce Cheng) writes:
  964. >
  965. >    Is there any good suggestion for Programming Guide for MPW? I curently only
  966. >    have the reference manual that comes with the package.
  967. >
  968. >    The MPW Programmer's Reference I and II.
  969. >    Same for MPW C, I only have the Programmer's Reference.
  970. >
  971. >    Or basically any material that can help me to shorten my learning curve
  972. >    on Mac programming ...
  973.  
  974. I know of only two How To Use MPW books other than the reference
  975. manuals that come with it. The first is an Ages Old book by Joel West
  976. (I don't remember the name or publisher).  This book covers MPW 2.0,
  977. and may not be of much use. More recently is "Programmer's Guide to MPW"
  978. (right...so I don't accidentally think the book is appropriate for my
  979. mother), by Mark Andrews, published as part of the Macintosh Inside 
  980. Out series by Addison Wesley Crusher. This book is marked as Volume 1,
  981. so I guess more volumes are forthcoming (I heard a rumor that a Volume
  982. 2 is being worked on by Neil Rhodes, who used to (or still does) work
  983. with Joel West).
  984.  
  985. I've never read either of these books, so I don't know if they're any
  986. good.
  987.  
  988. -- 
  989. - ----------------------------------------------------------------------------
  990. Keith Rollin           ---            <Taligent .signature under construction>
  991. Disclaimer: Pretty soon, I really _won't_ be speaking for Apple...
  992.  
  993.  
  994.  
  995. ---------------------------
  996.  
  997. From: frain@cis.ksu.edu (Jerry Frain)
  998. Subject: Gunky 32K static (initialized) data segment barrier
  999. Date: 22 Jan 92 05:29:08 GMT
  1000. Organization: Kansas State University, Dept. of Computing and Information Sciences
  1001.  
  1002. The other day, I decided to attempt to port gas (GNU assembler) to my
  1003. Mac, compiling it with THINK C 4.x.  (I was REAL bored, mind you.)
  1004.  
  1005. All of the files compiled with relative ease, except the file that
  1006. includes the description of the 68k assembly language.  The problem is
  1007. that the static array that contains the data for all of the
  1008. instructions is by itself larger than 32K.
  1009.  
  1010. A friend of mine suggested writing a program to read the information
  1011. from a file into dynamic memory, then save the result as a resource.
  1012.  
  1013. The idea at first appeared absurd.  Now that I think about it, it's
  1014. not too bad, and I'm fresh out of alternatives.  If you like the above
  1015. idea, I'd like to hear how you would save it as a resource.
  1016.  
  1017. My only other idea is to cut out (at least temporarily) the MMU (and
  1018. probably FPU) instructions, and see if that trims it down enough to
  1019. compile.
  1020.  
  1021. Obviously, I'm not the first person to be in this situation.  Anyone
  1022. else out there care to share other ideas for breaking the 32K static
  1023. data segment barrier?
  1024.  
  1025.   --Jerry
  1026.  
  1027. -- 
  1028. - ----------------------------------------------------------------------------
  1029. Jerry Frain, Systems Programmer         |  "Back off man, I'm a scientist."
  1030. Kansas State University                 |  frain@cis.ksu.edu
  1031. Department of Computer & Info Sciences  |  ...!rutgers!depot!frain
  1032.  
  1033.  
  1034.  
  1035. - -------------------------
  1036.  
  1037. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  1038. Subject:  Gunky 32K static (initialized) data segment barrier
  1039. Date: 22 Jan 92 14:32:00 GMT
  1040. Organization: Kalamazoo College
  1041.  
  1042. frain@cis.ksu.edu (Jerry Frain) writes:
  1043. >
  1044. >All of the files compiled with relative ease, except the file that
  1045. >includes the description of the 68k assembly language.  The problem is
  1046. >that the static array that contains the data for all of the
  1047. >instructions is by itself larger than 32K.
  1048. >
  1049. >A friend of mine suggested writing a program to read the information
  1050. >from a file into dynamic memory, then save the result as a resource.
  1051. >
  1052.  
  1053. The easiest way would be to upgrade to Think C 5, which supports
  1054. unlimited globals.
  1055.  
  1056. The _cheapest_ way would probably be to do as your friend suggested.
  1057. Here's the code I used.
  1058.  
  1059.     
  1060. Point thePlace;
  1061. Str255 thePrompt = "\pHi!";
  1062. macSFReply theSFReply;
  1063. short myDFRefNum;
  1064. Handle myBigHndl;
  1065. OSErr theOSErr;
  1066.  
  1067. SetPt(&thePlace, 30, 50);
  1068. SFGetFile(thePlace, thePrompt, (ProcPtr) NULL, -1, (SFTypeList*) NULL,
  1069.     (ProcPtr) NULL, &theSFReply);
  1070. if (! theSFReply.good)     /* if the user clicked "Cancel" */
  1071.     return; /* forget the whole thing */
  1072. theOSErr = FSOpen(theSFReply.fName, theSFReply.vRefNum,
  1073.     &myDFRefNum);
  1074. myBigHndl = NewHandle(200000L);
  1075. HLock(myBigHndl);
  1076. myCount = 190000L;
  1077. theOSErr = FSRead(myDFRefNum, &myCount, *myBigHndl);
  1078. SetHandleSize(myBigHndl, myCount);
  1079. AddResource(myBigHndl, 'DATA', 128, theSFReply.fName);
  1080. WriteResource(myBigHndl);
  1081.  
  1082.  
  1083. Since it's a one-time, quick-n-dirty solution, you don't have to worry
  1084. about creating a resource file, opening it, and closing it.  Just run
  1085. the project from Think C, and the AddResource and WriteResource will put
  1086. the new resource into the .project.rsrc file.  Then transfer that
  1087. resource over to the gas.project.rsrc file, and you're off and
  1088. running...
  1089. -- 
  1090.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  1091.  
  1092.  
  1093.  
  1094. - -------------------------
  1095.  
  1096. From: e-sink@uiuc.edu (Eric W. Sink)
  1097. Subject:  Gunky 32K static (initialized) data segment barrier
  1098. Date: 22 Jan 92 15:45:23 GMT
  1099. Organization: University of Illinois at Urbana-Champaign
  1100.  
  1101. In <frain.696058245@depot.cis.ksu.edu> frain@cis.ksu.edu (Jerry Frain) writes:
  1102.  
  1103. >Obviously, I'm not the first person to be in this situation.  Anyone
  1104. >else out there care to share other ideas for breaking the 32K static
  1105. >data segment barrier?
  1106.  
  1107. Yes, use Think C 5.0.
  1108.  
  1109. -- 
  1110. Eric W. Sink,  Spatial Analysis and Systems Team
  1111. USACERL, P.O. Box 9005, Champaign, IL 61826-9005
  1112. 1-800-USA-CERL x449,   e-sink@uiuc.edu
  1113.  
  1114.  
  1115.  
  1116. - -------------------------
  1117.  
  1118. From: russells@ccu1.aukuni.ac.nz (Russell Street)
  1119. Subject:  Gunky 32K static (initialized) data segment barrier
  1120. Date: 22 Jan 92 20:41:14 GMT
  1121. Organization: University of Auckland, New Zealand.
  1122.  
  1123. frain@cis.ksu.edu (Jerry Frain) writes:
  1124.  
  1125. ...
  1126.  
  1127. >Obviously, I'm not the first person to be in this situation.  Anyone
  1128. >else out there care to share other ideas for breaking the 32K static
  1129. >data segment barrier?
  1130.  
  1131. Get Think C 5 and turn on Far Code/Far Data.  Too easy?
  1132.  
  1133. If the problem is large arrays you can also do this:
  1134.  
  1135. Break the offending array declerations up so that they are under 32K each
  1136. and then write a special program to save these declerations into
  1137. resources (or the data fork of a file).
  1138.  
  1139. Then the initialization routines can NewPtr some large blocks,
  1140. GetResource these resources and copy them over to the blocks or
  1141. load the data in from the files.
  1142.  
  1143. Because of arrays and pointers are practically identical only
  1144. minor hitting will be required to get the declerations straight.
  1145.  
  1146. This does take a bit of effort, but it works succesfully.
  1147.  
  1148. Hope this helps someone...
  1149. - -----------------------------------------------------
  1150. And with that remark, folks, the case of the Crown vs
  1151. Russell Street (russells@ccu1.aukuni.ac.nz) was proven.
  1152.  
  1153.  
  1154.  
  1155. - -------------------------
  1156.  
  1157. From: siegel@world.std.com (Rich Siegel)
  1158. Subject:  Gunky 32K static (initialized) data segment barrier
  1159. Date: 22 Jan 92 07:18:03 GMT
  1160. Organization: Symantec Language Products Group
  1161.  
  1162. In article <frain.696058245@depot.cis.ksu.edu> frain@cis.ksu.edu (Jerry Frain) writes:
  1163. >The other day, I decided to attempt to port gas (GNU assembler) to my
  1164. >Mac, compiling it with THINK C 4.x.  (I was REAL bored, mind you.)
  1165. >
  1166. >All of the files compiled with relative ease, except the file that
  1167. >includes the description of the 68k assembly language.  The problem is
  1168. >that the static array that contains the data for all of the
  1169. >instructions is by itself larger than 32K.
  1170. >
  1171. >A friend of mine suggested writing a program to read the information
  1172. >from a file into dynamic memory, then save the result as a resource.
  1173. >
  1174. >The idea at first appeared absurd.  Now that I think about it, it's
  1175. >not too bad, and I'm fresh out of alternatives.  If you like the above
  1176. >idea, I'd like to hear how you would save it as a resource.
  1177. >
  1178. >My only other idea is to cut out (at least temporarily) the MMU (and
  1179. >probably FPU) instructions, and see if that trims it down enough to
  1180. >compile.
  1181.  
  1182.     Upgrade to THINK C 5.0. It supports FAR CODE and FAR DATA; the former
  1183. gives you up to 256K jump tables; the former gives you data space limited only
  1184. by available memory.
  1185.  
  1186. R.
  1187. -- 
  1188. - ---------------------------------------------------------------------
  1189. Rich Siegel                              Internet: siegel@world.std.com
  1190. Senior Software Engineer                 Applelink: SIEGEL
  1191. Symantec Languages Group
  1192.  
  1193.  
  1194.  
  1195. - -------------------------
  1196.  
  1197. From: russotto@eng.umd.edu (Matthew T. Russotto)
  1198. Subject:  Gunky 32K static (initialized) data segment barrier
  1199. Date: 22 Jan 92 21:15:59 GMT
  1200. Organization: College of Engineering, Maryversity of Uniland, College Park
  1201.  
  1202. In article <frain.696058245@depot.cis.ksu.edu> frain@cis.ksu.edu (Jerry Frain) writes:
  1203. >The other day, I decided to attempt to port gas (GNU assembler) to my
  1204. >Mac, compiling it with THINK C 4.x.  (I was REAL bored, mind you.)
  1205. >
  1206. >All of the files compiled with relative ease, except the file that
  1207. >includes the description of the 68k assembly language.  The problem is
  1208. >that the static array that contains the data for all of the
  1209. >instructions is by itself larger than 32K.
  1210. >
  1211. >A friend of mine suggested writing a program to read the information
  1212. >from a file into dynamic memory, then save the result as a resource.
  1213. >
  1214. >The idea at first appeared absurd.  Now that I think about it, it's
  1215. >not too bad, and I'm fresh out of alternatives.  If you like the above
  1216. >idea, I'd like to hear how you would save it as a resource.
  1217.  
  1218. Presumably this array is something like
  1219.  
  1220. struct foo {
  1221.   int bar
  1222.   char baz[42];
  1223.   int etc;
  1224. }
  1225.  
  1226. struct foo verybig[20] = {foo, bar, baz}
  1227.  
  1228. If so, I'd store it in the form it would appear in memory, so you can just
  1229. load it into the dynamic array:
  1230. MyHandle = GetResource(foo, 'foo ');
  1231. HLock(MyHandle);
  1232. verybig = *foo;
  1233.  
  1234. and be done with it.  Is there some
  1235. variable-length thing that might interfere.
  1236.  
  1237. >Obviously, I'm not the first person to be in this situation.  Anyone
  1238. >else out there care to share other ideas for breaking the 32K static
  1239. >data segment barrier?
  1240.  
  1241. MPW 3.2?  I think THINK 5.0 can do it too, but I haven't gotten to my copy 
  1242. yet :-(
  1243.  
  1244. -- 
  1245. Matthew T. Russotto    russotto@eng.umd.edu    russotto@wam.umd.edu
  1246. Your superior intellect is no match for our puny weapons! -- The Simpsons
  1247. Just say NO to police searches and seizures.  Make them use force.
  1248. (not responsible for bodily harm resulting from following above advice)
  1249.  
  1250.  
  1251.  
  1252. - -------------------------
  1253.  
  1254. From: keith@Apple.COM (Keith Rollin)
  1255. Subject:  Gunky 32K static (initialized) data segment barrier
  1256. Date: 28 Jan 92 23:20:27 GMT
  1257. Organization: Apple Computer Inc., Cupertino, CA
  1258.  
  1259. In article <frain.696058245@depot.cis.ksu.edu> frain@cis.ksu.edu (Jerry Frain) writes:
  1260. >The other day, I decided to attempt to port gas (GNU assembler) to my
  1261. >Mac, compiling it with THINK C 4.x.  (I was REAL bored, mind you.)
  1262. >
  1263. >All of the files compiled with relative ease, except the file that
  1264. >includes the description of the 68k assembly language.  The problem is
  1265. >that the static array that contains the data for all of the
  1266. >instructions is by itself larger than 32K.
  1267. >
  1268. >A friend of mine suggested writing a program to read the information
  1269. >from a file into dynamic memory, then save the result as a resource.
  1270. >
  1271. >The idea at first appeared absurd.  Now that I think about it, it's
  1272. >not too bad, and I'm fresh out of alternatives.  If you like the above
  1273. >idea, I'd like to hear how you would save it as a resource.
  1274. >
  1275. >My only other idea is to cut out (at least temporarily) the MMU (and
  1276. >probably FPU) instructions, and see if that trims it down enough to
  1277. >compile.
  1278. >
  1279. >Obviously, I'm not the first person to be in this situation.  Anyone
  1280. >else out there care to share other ideas for breaking the 32K static
  1281. >data segment barrier?
  1282.  
  1283. As most readers of this group know, Stan Shebs here at Apple has ported
  1284. GNU C to work under MPW. Over the X-Mas break, I was playing around
  1285. with it, and noticed that it had over 100K of global variables. Stan
  1286. was able to compile these because he used the -m option with the
  1287. compiler and linker. However, this generates larger and less efficient
  1288. code. So I decided to take the approach you suggested above, and moved
  1289. a lot of static data into resources. I wrote a little MPW tool that
  1290. searched for about a dozen pre-designated tables (which I had
  1291. identified as being global variable hogs from the link map). The tool
  1292. then turned the C source for the tables into Rez source (the two
  1293. syntaxes are very similar). Next, I added some code at the start of the
  1294. GNU C compiler to read in these resources, lock them down, and
  1295. initialize some pointers to them. Since arrays and pointers in C are
  1296. tightly coupled, modifying the rest of the GNU C source to use the
  1297. pointers instead of accessing a global array was pretty simple.
  1298.  
  1299. -- 
  1300. - ----------------------------------------------------------------------------
  1301. Keith Rollin           ---            <Taligent .signature under construction>
  1302. Disclaimer: Pretty soon, I really _won't_ be speaking for Apple...
  1303.  
  1304.  
  1305.  
  1306. - -------------------------
  1307.  
  1308. From: keith@Apple.COM (Keith Rollin)
  1309. Subject:  Gunky 32K static (initialized) data segment barrier
  1310. Date: 28 Jan 92 23:20:27 GMT
  1311. Organization: Apple Computer Inc., Cupertino, CA
  1312.  
  1313. In article <frain.696058245@depot.cis.ksu.edu> frain@cis.ksu.edu (Jerry Frain) writes:
  1314. >The other day, I decided to attempt to port gas (GNU assembler) to my
  1315. >Mac, compiling it with THINK C 4.x.  (I was REAL bored, mind you.)
  1316. >
  1317. >All of the files compiled with relative ease, except the file that
  1318. >includes the description of the 68k assembly language.  The problem is
  1319. >that the static array that contains the data for all of the
  1320. >instructions is by itself larger than 32K.
  1321. >
  1322. >A friend of mine suggested writing a program to read the information
  1323. >from a file into dynamic memory, then save the result as a resource.
  1324. >
  1325. >The idea at first appeared absurd.  Now that I think about it, it's
  1326. >not too bad, and I'm fresh out of alternatives.  If you like the above
  1327. >idea, I'd like to hear how you would save it as a resource.
  1328. >
  1329. >My only other idea is to cut out (at least temporarily) the MMU (and
  1330. >probably FPU) instructions, and see if that trims it down enough to
  1331. >compile.
  1332. >
  1333. >Obviously, I'm not the first person to be in this situation.  Anyone
  1334. >else out there care to share other ideas for breaking the 32K static
  1335. >data segment barrier?
  1336.  
  1337. As most readers of this group know, Stan Shebs here at Apple has ported
  1338. GNU C to work under MPW. Over the X-Mas break, I was playing around
  1339. with it, and noticed that it had over 100K of global variables. Stan
  1340. was able to compile these because he used the -m option with the
  1341. compiler and linker. However, this generates larger and less efficient
  1342. code. So I decided to take the approach you suggested above, and moved
  1343. a lot of static data into resources. I wrote a little MPW tool that
  1344. searched for about a dozen pre-designated tables (which I had
  1345. identified as being global variable hogs from the link map). The tool
  1346. then turned the C source for the tables into Rez source (the two
  1347. syntaxes are very similar). Next, I added some code at the start of the
  1348. GNU C compiler to read in these resources, lock them down, and
  1349. initialize some pointers to them. Since arrays and pointers in C are
  1350. tightly coupled, modifying the rest of the GNU C source to use the
  1351. pointers instead of accessing a global array was pretty simple.
  1352.  
  1353. -- 
  1354. - ----------------------------------------------------------------------------
  1355. Keith Rollin           ---            <Taligent .signature under construction>
  1356. Disclaimer: Pretty soon, I really _won't_ be speaking for Apple...
  1357.  
  1358.  
  1359.  
  1360. ---------------------------
  1361.  
  1362. End of C.S.M.P. Digest
  1363. **********************
  1364.